<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<script type="text/javascript">
	dojo.require("dijit.TitlePane");
</script>
<fmt:message key="label.page1.title"/>
<hr>
<div dojoType="dijit.TitlePane" style="width: 100%"
	title="Contact Manager">
	<form:form id="addContact" method="post" action="addContact.html" commandName="contact">
	<table>
		<tr>
			<td><form:label path="firstname">
					<spring:message code="Contact.firstname"/>
				</form:label>
			</td>
			<td><form:input path="firstname" cssErrorClass="form-error-field"/></td>
			<td><form:errors path="firstname" cssClass="form-error-message" /></td>
		</tr>
		<tr>
			<td><form:label path="lastname">
					<spring:message code="Contact.lastname" />
				</form:label>
			</td>
			<td><form:input path="lastname" cssErrorClass="form-error-field"/></td>
			<td><form:errors path="lastname" cssClass="form-error-message" /></td>
		</tr>
		<tr>
			<td><form:label path="email">
				<spring:message code="Contact.email" />
			</form:label></td>
			<td><form:input path="email" cssErrorClass="form-error-field"/></td>
			<td><form:errors path="email" cssClass="form-error-message" /></td>
		</tr>
		<tr>
			<td><form:label path="birthDate">
				<spring:message code="Contact.birthDate" />
			</form:label></td>
			<td><form:input path="birthDate" cssErrorClass="form-error-field"/></td>
			<td><form:errors path="birthDate" cssClass="form-error-message" /></td>
		</tr>

		<tr>
			<td colspan="2">
			<button type="submit" id="save" name="_eventId_proceed"><spring:message
				code="Contact.save" /></button>
		</tr>
	</table>
</form:form></div>
<script type="text/javascript">
	Spring.addDecoration(new Spring.ElementDecoration({
		elementId : 'firstname',
		widgetType : 'dijit.form.ValidationTextBox',
		widgetAttrs : {
			promptMessage : '<spring:message code="Contact.firstname.tooltip"/>',
			required : true
		}
	}));
	Spring.addDecoration(new Spring.ElementDecoration({
		elementId : 'lastname',
		widgetType : 'dijit.form.ValidationTextBox',
		widgetAttrs : {
			promptMessage : '<spring:message code="Contact.lastname.tooltip"/>',
			required : true
		}
	}));
	Spring.addDecoration(new Spring.ElementDecoration({
		elementId : 'email',
		widgetType : 'dijit.form.ValidationTextBox',
		widgetAttrs : {
			promptMessage : '<spring:message code="Contact.email.tooltip"/>',
			required : true
		}
	}));
	Spring.addDecoration(new Spring.ElementDecoration({
		elementId : 'birthDate',
		widgetType : 'dijit.form.DateTextBox',
		widgetAttrs : {
			promptMessage : '<spring:message code="Contact.birthDate.tooltip"/>',
			datePattern : 'dd/MM/yyyy',
			required : true
		}
	}));

	Spring.addDecoration(new Spring.ValidateAllDecoration({
		elementId : 'save',
		event : 'onclick'
	}));
	Spring.addDecoration(new Spring.ElementDecoration({
		elementId : 'save',
		widgetType : 'dijit.form.Button'
	}));
</script>